<template>
  <div class="user_bind_elder">
    <aplid-base-crud ref="crud" v-bind="baseConfig">
      
      <template #menuColumn="{ row }">
          <el-popconfirm :title="`是否对此条信息进行${row.ruleEnable == 0 ? '启用' : '停用'}？`" @confirm="handleConfirm(row)">
            <template #reference>
              <span>
                <el-button :type="row.ruleEnable == 0 ? 'success' : 'danger'" link> {{ row.ruleEnable == 0 ? '启用' : '停用' }}</el-button>
              </span>
            </template>
          </el-popconfirm>
      </template>
    </aplid-base-crud>
  </div>
</template>

<script setup lang="ts">
// import { AplidAreaSelect } from '@/components/AplidCrud';
import { baseConfig } from './config.js'
// import type { FormInstance, FormRules } from 'element-plus'
import api from '@/apiMod'
import { ElMessage } from 'element-plus'


const crud = ref(null)
const handleConfirm = async (row) => {
  const params = {
    id: row.id,
    ruleAgeStart: row.ruleAgeStart,
    ruleAgeEnd: row.ruleAgeEnd,
    ruleEnable: row.ruleEnable == 0 ? 1 : 0
  }
  const res = await api.view_bscBusinessRule_edit(params)
  if(res.code == 0){
    ElMessage.success(res.data)
    crud.value.refreshChange()
  }
}

</script>

<style scoped lang="scss"></style>